import JsEncrypt from 'jsencrypt/bin/jsencrypt.min.js';

// 公钥
// MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCuQ1DDooRV+5vtfaS+Ik9Ehlja
// 7FRwxdEM3batAK03CrmT7veh5TimazNp6Hb4IdORHSlkgAOEfowb4JllgQmD+s2M
// Z2XPRdRKdrqZcPg0CrqlJr7sWwt89DcuizbRbNOPFcUYJr+gT8SgKwCTIpdlBz1y
// J/vL1fKBpbbLMfsotQIDAQAB

let publicKey =
    'MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCuQ1DDooRV+5vtfaS+Ik9Ehlja' +
    '7FRwxdEM3batAK03CrmT7veh5TimazNp6Hb4IdORHSlkgAOEfowb4JllgQmD+s2M' +
    'Z2XPRdRKdrqZcPg0CrqlJr7sWwt89DcuizbRbNOPFcUYJr+gT8SgKwCTIpdlBz1y' +
    'J/vL1fKBpbbLMfsotQIDAQAB';

let encrypt;
const RsaHelper= {
    doEncrypt(pwd){
        if (!encrypt) {
            encrypt = new JsEncrypt();
            encrypt.setPublicKey(publicKey);
        }
        return encrypt.encrypt(pwd);
    }

};
export default RsaHelper;